package cn.sdack.go.common.entities.users;

import cn.sdack.go.common.entities.BaseEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.validator.constraints.Length;

/**
 * @author sdack
 * @date 2024/2/17
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "dict_item",indexes = {
        @Index(name = "idx_dict_item_code",columnList = "code"),
        @Index(name = "idx_dict_item_pid",columnList = "pid")
})
public class DictItemEntity extends BaseDictEntity {

    @NotNull(message = "字典项ID - 必填",groups = {BaseEntity.Set.class})
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private Long pid;

    @NotNull(message = "字典项值 - 必填",groups = {BaseEntity.Add.class,BaseEntity.Set.class})
    @Length(min = 1,max = 50,message = "字典项值 - 长度不正确",groups = {BaseEntity.Add.class,BaseEntity.Set.class})
    private String v;
}
